package at.fhv.wordProcessing.data;

/**
 * The Line class.
 * 
 * @author Michael Sieber
 */
public class Line {
	private StringBuilder _words;
	private int _length;
	private Alignment _alignment;

	public Line(int length, Alignment alignment) {
		_length = length;
		_alignment = alignment;
		_words = new StringBuilder();
	}

	/**
	 * Add a word to a line
	 * 
	 * @param word The word to add
	 * @return True if the line length is not exceeded
	 */
	public boolean addWord(String word) {
		if (_words.length() < _length) {
			_words.append(word);
			return true;
		}

		return false;
	}

	/**
	 * Get the alignment
	 * 
	 * @return The alignment of this line
	 */
	public Alignment getAlignment() {
		return _alignment;
	}
}
